<template>
    <div id="count" ref="countEle">{{ count }}</div>
    <button @click="add">count++</button>
</template>

<script>
export default {
    data() {
        return {
            count: 1
        }
    },
    methods: {
        async add() {
            // 异步更新
            this.count++
            // 同步获取
            console.log(document.getElementById('count').innerText);
            console.log(this.$refs.countEle.innerText)
            // this.$nextTick(function () {
            //     console.log(document.getElementById('count').innerText);
            //     console.log(this.$refs.countEle.innerText)
            // })
            await this.$nextTick()
            console.log(document.getElementById('count').innerText);
            console.log(this.$refs.countEle.innerText)
        }
    },
}
</script>